﻿using System.Text.RegularExpressions;

namespace ApplicationBase.Core.Extensions
{
    public static class StringExtensions
    {
        public static bool IsEmailAddress(this string value) 
        { 
            Regex rgx = new Regex(@"\w[-_\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}");
            return rgx.IsMatch(value);
        }

        public static bool IsChinesePhoneNumber(this string value)
        {
            Regex rgx = new Regex(@"(13|14|15|18)[0-9]{9}");
            return rgx.IsMatch(value);
        }

        public static bool HasChineseChar(this string value)
        {
            Regex rgx = new Regex("[\u4e00-\u9fa5]");
            return rgx.IsMatch(value);
        }
    }
}
